import rxAjax from '@/assets/js/ajax.js';

//路由 api接口
export const SysRoutingApi = {};

SysRoutingApi.baseUrl= '/api-system/system/core/sysRouting';
SysRoutingApi.exportUrl= SysRoutingApi.baseUrl + '/listExport';

//查询列表
SysRoutingApi.query=function (parameter) {
  var url= SysRoutingApi.baseUrl + '/query';
  return rxAjax.postJson(url,parameter).then (res => {
    return res.result
  })
}

/**
* 获取单记录
* @param pkId
* @returns {*}
*/
SysRoutingApi.get =function(pkId) {
  var url= SysRoutingApi.baseUrl + '/get?pkId=' + pkId;
  return rxAjax.get(url);
}

//保存数据
SysRoutingApi.save =function(parameter) {
  var url= SysRoutingApi.baseUrl + '/saveRouting';
  return rxAjax.postJson(url,parameter);
}

//更新数据
SysRoutingApi.update =function(parameter) {
  var url= SysRoutingApi.baseUrl + '/updateRouting';
  return rxAjax.postJson(url,parameter);
}

//删除数据
SysRoutingApi.del =function(parameter) {
  var url= SysRoutingApi.baseUrl + '/del';
  return rxAjax.postUrl(url,parameter);
}

SysRoutingApi.getRoutingByType =function(routeType) {
  var url= SysRoutingApi.baseUrl +'/getRoutingByType';
  return rxAjax.postJson(url,routeType);
}

SysRoutingApi.getRoutingApi =function() {
  var url=SysRoutingApi.baseUrl +'/getConfig';
  return rxAjax.get(url);
}

SysRoutingApi.publish =function(content) {
  var url= SysRoutingApi.baseUrl + '/publish';
  var config={config:JSON.stringify(content)};
  return rxAjax.postJson(url,config);
}

export  default SysRoutingApi;

